<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>spade.xmpp.commands.Commands</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="spade-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://spade2.googlecode.com">SPADE</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="spade-module.html">Package&nbsp;spade</a> ::
        <a href="spade.xmpp-module.html">Package&nbsp;xmpp</a> ::
        <a href="spade.xmpp.commands-module.html">Module&nbsp;commands</a> ::
        Class&nbsp;Commands
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="spade.xmpp.commands.Commands-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class Commands</h1><p class="nomargin-top"><span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands">source&nbsp;code</a></span></p>
<center>
<center>  <map id="uml_class_diagram_for_spade_xm_12" name="uml_class_diagram_for_spade_xm_12">
<area shape="rect" id="node2505" href="spade.xmpp.commands.Commands-class.html#__init__" title="Initialises class and sets up local variables" alt="" coords="17,153,353,172"/>
<area shape="rect" id="node2505" href="spade.xmpp.commands.Commands-class.html#plugin" title="Makes handlers within the session" alt="" coords="17,172,353,191"/>
<area shape="rect" id="node2505" href="spade.xmpp.commands.Commands-class.html#plugout" title="Removes handlers from the session" alt="" coords="17,191,353,209"/>
<area shape="rect" id="node2505" href="spade.xmpp.commands.Commands-class.html#addCommand" title="The method to call if adding a new command to the session, the requred &#160;parameters of cmddisco and cmdexecute are the methods to enable that &#160;command to be executed" alt="" coords="17,209,353,228"/>
<area shape="rect" id="node2505" href="spade.xmpp.commands.Commands-class.html#delCommand" title="Removed command from the session" alt="" coords="17,228,353,247"/>
<area shape="rect" id="node2505" href="spade.xmpp.commands.Commands-class.html#getCommand" title="Returns the command tuple" alt="" coords="17,247,353,265"/>
<area shape="rect" id="node1" href="spade.xmpp.commands.Commands-class.html" title="Commands is an ancestor of PlugIn and can be attached to any session." alt="" coords="5,121,365,271"/>
<area shape="rect" id="node2506" href="spade.xmpp.client.PlugIn-class.html#DEBUG" title="Feed a provided debug line to main instance&#39;s debug facility along with our ID string." alt="" coords="83,39,287,57"/>
<area shape="rect" id="node2506" href="spade.xmpp.client.PlugIn-class.html#PlugIn" title="Attach to main instance and register ourself and all our staff in it." alt="" coords="83,57,287,76"/>
<area shape="rect" id="node2506" href="spade.xmpp.client.PlugIn-class.html#PlugOut" title="Unregister all our staff from main instance and detach from it." alt="" coords="83,76,287,95"/>
<area shape="rect" id="node2" href="spade.xmpp.client.PlugIn-class.html" title="Common xmpppy plugins infrastructure: plugging in/out, debugging." alt="" coords="71,6,297,101"/>
</map>
  <img src="uml_class_diagram_for_spade_xm_12.gif" alt='' usemap="#uml_class_diagram_for_spade_xm_12" ismap="ismap" class="graph-without-title" />
</center>
</center>
<hr />
<pre class="literalblock">
Commands is an ancestor of PlugIn and can be attached to any session.

The commands class provides a lookup and browse mechnism. It follows the same priciple of the Browser class, for Service Discovery to provide the list of commands, it adds the 'list' disco type to your existing disco handler function. 

How it works:
    The commands are added into the existing Browser on the correct nodes. When the command list is built the supplied discovery handler function needs to have a 'list' option in type. This then gets enumerated, all results returned as None are ignored.
    The command executed is then called using it's Execute method. All session management is handled by the command itself.

</pre>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="spade.xmpp.commands.Commands-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">browser</span>)</span><br />
      Initialises class and sets up local variables</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="plugin"></a><span class="summary-sig-name">plugin</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">owner</span>)</span><br />
      Makes handlers within the session</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands.plugin">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="plugout"></a><span class="summary-sig-name">plugout</span>(<span class="summary-sig-arg">self</span>)</span><br />
      Removes handlers from the session</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands.plugout">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_CommandHandler"></a><span class="summary-sig-name">_CommandHandler</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">conn</span>,
        <span class="summary-sig-arg">request</span>)</span><br />
      The internal method to process the routing of command execution 
      requests</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands._CommandHandler">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_DiscoHandler"></a><span class="summary-sig-name">_DiscoHandler</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">conn</span>,
        <span class="summary-sig-arg">request</span>,
        <span class="summary-sig-arg">typ</span>)</span><br />
      The internal method to process service discovery requests</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands._DiscoHandler">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="addCommand"></a><span class="summary-sig-name">addCommand</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>,
        <span class="summary-sig-arg">cmddisco</span>,
        <span class="summary-sig-arg">cmdexecute</span>,
        <span class="summary-sig-arg">jid</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span><br />
      The method to call if adding a new command to the session, the 
      requred parameters of cmddisco and cmdexecute are the methods to 
      enable that command to be executed</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands.addCommand">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="delCommand"></a><span class="summary-sig-name">delCommand</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>,
        <span class="summary-sig-arg">jid</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span><br />
      Removed command from the session</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands.delCommand">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="getCommand"></a><span class="summary-sig-name">getCommand</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>,
        <span class="summary-sig-arg">jid</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span><br />
      Returns the command tuple</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands.getCommand">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="spade.xmpp.client.PlugIn-class.html">client.PlugIn</a></code></b>:
      <code><a href="spade.xmpp.client.PlugIn-class.html#DEBUG">DEBUG</a></code>,
      <code><a href="spade.xmpp.client.PlugIn-class.html#PlugIn">PlugIn</a></code>,
      <code><a href="spade.xmpp.client.PlugIn-class.html#PlugOut">PlugOut</a></code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">browser</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="spade.xmpp.commands-pysrc.html#Commands.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Initialises class and sets up local variables</p>
  <dl class="fields">
    <dt>Overrides:
        <a href="spade.xmpp.client.PlugIn-class.html#__init__">client.PlugIn.__init__</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="spade-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://spade2.googlecode.com">SPADE</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Wed Aug  1 18:44:56 2012
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
